<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>确认订单</title>

    <link href="css/common.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="./js/common.js"></script>
    <script type="text/javascript" src="./js/jquery.min.js"></script>
    <!-- <script type="text/javascript" src="./js/first.js"></script> -->
    <style>

    </style>
</head>

<body>

</body>
<script>
    $(function() {
        // console.log(8989)
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
        console.log(GetQueryString("r"))
        if (GetQueryString("r")) { //微信回调
            var res1 = GetQueryString("r");
            var res = JSON.parse(res1);
            // console.log(res);
            if (Number(res.errcode) == 0) {
                var openid = res.data.openid;
                window.sessionStorage.setItem('openid', openid);

                if (window.sessionStorage.ucp_id) {
                    var ucp_id = window.sessionStorage.getItem('ucp_id');
                    var appid = window.sessionStorage.getItem('appid');
                    var is_skillfrom = window.sessionStorage.getItem('is_skillfrom');
                    if (sessionStorage.getItem('phone')) {
                        var phone = sessionStorage.getItem('phone');
                        var price = sessionStorage.getItem('price');
                    } else {
                        var phone = '';
                        var price = '';
                    }
                    window.location.href = 'ordernew.html?ucp_id=' + ucp_id + '&appid=' + appid + '&phone=' + phone + '&price=' + price + '&is_skillfrom=' + is_skillfrom + '';
                }
            } else {
                if (window.sessionStorage.ucp_id) {
                    var ucp_id = window.sessionStorage.getItem('ucp_id');
                    var appid = window.sessionStorage.getItem('appid');
                    var is_skillfrom = window.sessionStorage.getItem('is_skillfrom');
                    if (sessionStorage.getItem('phone')) {
                        var phone = sessionStorage.getItem('phone');
                        var price = sessionStorage.getItem('price');
                    } else {
                        var phone = '';
                        var price = '';
                    }
                    window.location.href = 'ordernew.html?ucp_id=' + ucp_id + '&appid=' + appid + '&phone=' + phone + '&price=' + price + '&is_skillfrom=' + is_skillfrom + '';
                }
            }
        } else {
            var res1 = GetQueryString("res");
            var res = JSON.parse(res1);
            // console.log(res);
            if (Number(res.errcode) == 0) {
                var ucp_id = window.sessionStorage.getItem('ucp_id');
                var appid = window.sessionStorage.getItem('appid');
                window.location.href = 'ordernew.html?ucp_id=' + ucp_id + '&typeerrcode=1&appid=' + appid + '';
            } else {
                var ucp_id = window.sessionStorage.getItem('ucp_id');
                var appid = window.sessionStorage.getItem('appid');
                window.location.href = 'ordernew.html?ucp_id=' + ucp_id + '&typeerrcode=2&appid=' + appid + '';
            }
        }

    })
</script>

</html>